package org.hyf.inspur.LessonDesin.clear.count;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;
import java.util.Iterator;


public class PvReducer extends Reducer<Text, Text,Text, NullWritable> {
    protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
        Iterator<Text> it = values.iterator();
        int count = 0;
        while (it.hasNext()) {
            Text temp = it.next();
            count++;
        }
        String str = key+String.valueOf(count);
        context.write(new Text(str),NullWritable.get());
    }
}
